#!/bin/sh

set -e

if [ "$1" = triggered ]; then
  # Force regeneration of all fontconfig cache files.
  mkdir -p @MEMO_PREFIX@/var/cache/fontconfig
  fc-cache -s -v 1>@MEMO_PREFIX@/var/log/fontconfig.log 2>&1 || printf "fc-cache failed.\nSee @MEMO_PREFIX@/var/log/fontconfig.log for more information.\n"
  exit 0
fi

#DEBHELPER#

if [ "$1" = configure ]; then
  # Force regeneration of all fontconfig cache files.
  mkdir -p @MEMO_PREFIX@/var/cache/fontconfig
  printf "Regenerating fonts cache... "
  fc-cache -s -f -v 1>@MEMO_PREFIX@/var/log/fontconfig.log 2>&1 || (printf "failed.\nSee @MEMO_PREFIX@/var/log/fontconfig.log for more information.\n"; exit 1)
  printf "done.\n"
fi
